* Date: September 1, 2021
* Purpose: Figures & tables for MDP application

cls
clear all 
set more off
capture log close

cd "D:\Dropbox\data"

********************************************************************************
* Figure 3B
********************************************************************************

use MDP_Fig3.dta, clear

* Figure 3 (B)

generate lnRate = log(Rate)
bytwoway (line lnRate Year), by(MDP) aes(color lpattern) ylabel(5.8(0.1)6.1) xlabel(2010(1)2015) xline(2013) xtitle("Year",size(medlarge) height(6)) ytitle("Log Hosp CSPC Rate", size(medlarge) height(6)) graphregion(color(white)) bgcolor(white) 


********************************************************************************
* Tables
********************************************************************************

* Table 3: MDP Effect in 60-74 years-old

use MDP_Table3.dta, clear


xtset Code Year 

* Models for CSPC Hospitalizations


* Poisson Model
xtpoisson Hosp MDP time Interaction Lifeexp Illiteracy GINI Income Water Urban,exposure(Pop) fe
xtpoisson Hosp MDP time Interaction Lifeexp Illiteracy GINI Income Water Urban,exposure(Pop) fe irr

* Negative Binomial Model
xtnbreg Hosp MDP time Interaction Lifeexp Illiteracy GINI Income Water Urban,exposure(Pop) fe
xtnbreg Hosp MDP time Interaction Lifeexp Illiteracy GINI Income Water Urban,exposure(Pop) fe irr



